#pragma once

#include <D3D10.h>
#include "PreApi Classes/IFileLoad/IFileLoad.h"

class CID3D10Include: public ID3D10Include
{
public:
    STDMETHOD(Open)(D3D10_INCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes)
    {
        CIFileLoad *pIFL = CIFileLoad::GetIFL( );
        if( !pIFL )
            return E_FAIL;
        if (!pIFL->LoadFile(pFileName, ppData, pBytes))
            return E_FAIL;

        return S_OK;
    }

    STDMETHOD(Close)( LPCVOID pData )
    {
        char *pBuffer = (char *)pData;
        delete [] pBuffer;
        return S_OK;
    }

    static CID3D10Include g_D3D10Include;
};
    
    